<%@ page import="com.lsk.util.UtilUUID" %>
<%@ page import="com.lsk.util.GlobalParameter" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/10/27 0027
  Time: 下午 5:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <title>${activityInfo.name}</title>
    <link rel="stylesheet" type="text/css" href="/mobileGroup/groupCss/groupIndex.css?version=<%=UtilUUID.getUUID()%>" />
    <link rel="stylesheet" type="text/css" href="/layui-v2.2.5/layui/css/layui.css" />
    <script src="/js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript" charset="utf-8"></script>
    <script src="/layui-v2.2.5/layui/layui.js"></script>

    <script src="groupJs/groupIndex.js?version=<%=UtilUUID.getUUID()%>" type="text/javascript" charset="utf-8"></script>
    <style>

    </style>
</head>
<body>
<input type="hidden" id="groupId" value="${groupId}">
<input type="hidden" id="parentId" value="${member.id}">
<input type="hidden" id="orgId" value="${orgInfo.id}">
<input type="hidden" id="activityId" value="${activityInfo.id}">
<input type="hidden" id="tempGroupId" value="<%=UtilUUID.getUUID()%>">
<script>
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '${wxAuthorization.appid}', // 必填，公众号的唯一标识
        timestamp:${wxAuthorization.timestamp}, // 必填，生成签名的时间戳
        nonceStr: '${wxAuthorization.nonceStr}', // 必填，生成签名的随机串
        signature: '${wxAuthorization.signature}',// 必填，签名
        jsApiList: ['updateAppMessageShareData','updateTimelineShareData','hideMenuItems','showMenuItems','onMenuShareAppMessage','onMenuShareTimeline'] // 必填，需要使用的JS接口列表
    });

    wx.ready(function(){

        //老版本
        wx.onMenuShareAppMessage({
            title: '${member.name}邀请您参加${activityInfo.name}', // 分享标题
            desc: '${activityInfo.transmitTitle}', // 分享描述
            link: 'http://<%=GlobalParameter.domain%>/mobileGroup/groupIndex?orgId=${orgInfo.id}&activityId=${activityInfo.id}&parentId=${member.id}&groupId=${groupId}', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: '${logoPath}', // 分享图标
            success:function(res) {
                //window.location.href="/mobileMarketing/transmitFriend?uuid=${uuid}";
                //这里是回调函数
                transmitFriend();
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });

        //自定义“分享到朋友圈”及“分享到QQ空间”按钮的分享内容（1.4.0）
        wx.onMenuShareTimeline({
            title: '${member.name}邀请您参加${activityInfo.transmitTitle}', // 分享标题
            link: 'http://<%=GlobalParameter.domain%>/mobileGroup/groupIndex?orgId=${orgInfo.id}&activityId=${activityInfo.id}&parentId=${member.id}&groupId=${groupId}', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: '${logoPath}', // 分享图标
            success: function(res) {
                //这里是回调函
                transmitMoments();
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });

        wx.hideMenuItems({
            menuList: ['menuItem:share:qq','menuItem:share:weiboApp','menuItem:favorite','menuItem:share:facebook'
                ,'menuItem:share:QZone','menuItem:originPage','menuItem:readMode','menuItem:openWithQQBrowser'
                ,'menuItem:openWithSafari','menuItem:copyUrl'] // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
        });
        wx.showMenuItems({
            menuList: ['menuItem:profile','menuItem:addContact'] // 要显示的菜单项，所有menu项见附录3
        });

    });
</script>



<input type="hidden" name="orgId" value="${orgInfo.id}">
<input type="hidden" name="activityId" value="${activityInfo.id}">
<input type="hidden" name="uuid" id="uuid" value="${uuid}">
<input type="hidden" name="endTime" id="endTime" value="${activityInfo.endTime}">
<div id="payDiv"></div>

<div class="mb" id="mb">
    <div id="fx_img" >
        <img src="groupImg/groupfxbg.png" style="width: 25rem; height: 24rem">
    </div>
</div>

<div id="audioBox" class="audio_box" style="background-image:url(/mobileMarketing/img/music.png)" onclick="pauseAudio()">
    <audio id="audio1" preload="auto" autoplay loop>
        <source src="http://resource.dingyuankeji.shop/dingyuan/activity2020/${orgInfo.id}/${activityInfo.id}.mp3" type="audio/mpeg">
    </audio>
</div>



<script>
    var x = document.getElementById("audio1");
    function pauseAudio() {
        if(x.paused) {
            x.play();
        } else {
            x.pause();
        }
    }
</script>

<c:forEach items="${imgPathList}" var="imgList" begin="0" end="0">
    <img src='${imgList.path}?version=${imgList.version}' class="img_list">
</c:forEach>







<div id="daojishi" class="daojishi">
    <span style="font-weight: bold; margin-left: 1rem">活动倒计时：</span>
    <!--<div> 6</div><div>天</div>-->
    <!--<div> 6</div><div>时</div>-->
    <!--<div> 6</div><div>分</div>-->
    <!--<div> 6</div><div>秒</div>-->

    <span class="shijian">
                &nbsp;&nbsp;
                <span id="_d" style="color:#FF252F ">0</span> <span>天</span>
                <span id="_h" style="color:#FF252F ">0</span><span>时</span>
                <span id="_m" style="color:#FF252F ">0</span><span>分</span>
                <span id="_s" style="color:#FF252F ">0</span><span>秒</span>
                &nbsp;&nbsp;
            </span>

</div>
<%-- 红包规则--%>
<c:if test="${activityInfo.isRedPacket!=0}">
    <div style="border: 0.4rem solid #ff4459;">
        <div style="text-align: center;margin-top: 1rem">
            <img src="groupImg/ruleLeft.png">
            <text style="font-weight: bold">平&nbsp;台&nbsp;补&nbsp;贴&nbsp;规&nbsp;则</text>
            <img src="groupImg/ruleRight.png">
        </div>
        <div style="width: 87%;font-size: 1.1rem;font-weight: bold;margin-left: 1.6rem">
            <p style="left: 5%;margin-top: 1rem">
                <img src="groupImg/li.png" style="height: 1rem;width: 1rem">&nbsp;客户将活动分享朋友参与可获得平台
                <span style="color: red">${activityInfo.oneRebate/100}</span>元的现金红包奖励</p>
            <p style="left: 5%;margin-top: 1rem">
                <img src="groupImg/li.png" style="height: 1rem;width: 1rem">&nbsp;二次分享朋友参与平台再次给予
                <span style="color: red">${activityInfo.twoRebate/100}</span>的现金红包奖励</p>
            <p style="left: 5%;margin-top: 1rem">
                <img src="groupImg/li.png" style="height: 1rem;width: 1rem">&nbsp;现金红包奖励时间为推广期的20日内，超过时间平台不再奖励</p>
            <br>
        </div>
    </div>
</c:if>




<%--设定的有拼团规则--%>
<c:if test="${ruleList !=null}">
    <div style="border: 0.4rem solid #f77d46;margin-top: 0.2rem">
        <div style="text-align: center;margin-top: 1rem">
            <img src="groupImg/ruleLeft.png">
            <text style="font-weight: bold">【${activityInfo.groupNumber}&nbsp;人】&nbsp;团&nbsp;规&nbsp;则</text>
            <img src="groupImg/ruleRight.png">
        </div>
        <div style="width: 87%;font-size: 1.1rem;font-weight: bold;margin-left: 1.6rem">
            <c:forEach items="${ruleList}" var="rule">
                <p style="left: 5%;margin-top: 1rem">
                    <img src="groupImg/li.png" style="height: 1rem;width: 1rem">
                    团人数达到<span style="color: red">${rule.personNumber}</span>人，拼团价为<span style="color: red">${(originalPrice-rule.money)/100}</span>元，系统自动向已支付客户退还差额。
                </p>
            </c:forEach>

            <br>
        </div>
    </div>
</c:if>


<c:if test="${packConfig !=null}">
    <div style="border: 0.4rem solid #5FB878;margin-top: 0.2rem">
        <div style="text-align: center;margin-top: 1rem">
            <img src="groupImg/ruleLeft.png">
            <text style="font-weight: bold">推&nbsp;广&nbsp;补&nbsp;贴&nbsp;规&nbsp;则</text>
            <img src="groupImg/ruleRight.png">
        </div>
        <div style="width: 87%;font-size: 1.1rem;font-weight: bold;margin-left: 1.6rem">
            <p style="left: 5%;margin-top: 1rem">
                <img src="groupImg/li.png" style="height: 1rem;width: 1rem">&nbsp;推广人数达到${packConfig.population}人（无论是否购买，均是您的推广人数），
                平台将向您随机发放${packConfig.minPrice} 至 99.00元红包
                <br>
        </div>
    </div>
</c:if>



<c:forEach items="${imgPathList}" var="imgList" begin="1">
    <img src='${imgList.path}?version=${imgList.version}' class="img_list">
</c:forEach>
<%--左边漂浮数据--%>
<%--<div class="wz_box" id="wx_box">--%>

<%--</div>--%>

<%--加载支付弹窗--%>


<div id="groupBeforehandPay">


</div>

<c:if test="${activityInfo.isRedPacket!=0}">
    <button  class="hongbao" onclick="packetLogs();"></button>
</c:if>







<div class="footer_box" id="footer_box"></div>





<div class="anniu">
    <a href="/mobileGroup/groupGoMyInfo?orgId=${orgInfo.id}&activityId=${activityInfo.id}&parentId=${member.id}&groupId=${groupId}" class="wode"><img src="groupImg/wode.png"
                                                                                                                                                      style="height: 2.6rem;width: 30%;margin-left: 2rem;"></a>
    <%--index页面按钮类型  0 单独购买  1 立即开团  2 参与拼团  3 立即分享--%>

    <c:choose>
        <c:when test="${buttonType == 1}">
            <button type = "button"  style="background-color: #FF525A" onclick="pay('${uuid}',${activityInfo.alonePrice/100},1)">￥${activityInfo.alonePrice/100}<br>单独购买</button>
            <button type = "button" style="background-color: #FF030F" onclick="pay('${uuid}',${activityInfo.price/100},0)">￥${activityInfo.price/100}<br>立即开团</button>
        </c:when>
        <c:when test="${buttonType == 2}">
            <button type = "button" style="background-color: #FF525A" onclick="pay('${uuid}',${activityInfo.alonePrice/100},1)">￥${activityInfo.alonePrice/100}<br>单独购买</button>
            <button type = "button" style="background-color: #FF030F" onclick="pay('${uuid}',${activityInfo.price/100},0)">￥${activityInfo.price/100}<br>参加团购</button>
        </c:when>
        <c:when test="${buttonType == 3}">
            <audio id="xqt" src="groupImg/fenxiang.mp3"></audio>
            <button  type = "button" style="background-color: #ECE030;color: black;width: 66%;
            font-size: 1.5rem;height: 3.15rem" onclick="share()">立即分享</button>
        </c:when>
    </c:choose>

</div>

<div class="mask" id="mask" onclick="click1()"></div>
<c:choose>
    <c:when test="${activityInfo.isAddress ==1}">  <%--需要填写地址--%>
        <div class="tcbox" id="tcbox" style="height: 18rem;">
            <div class="tctit">我要参与</div>
            <div class="close" id="close" onclick="closeTcbox()">关闭</div>
            <p>请留下联系方式以便我们及时联系您！</p>
            <input type="text" id="name" placeholder="请输入姓名">
            <input type="text" id="tel" placeholder="请输入电话号码">
            <textarea type="text" id="address" placeholder="请输入地址" ></textarea>
            <button style="margin-left: 16%";type="button" id="payId" onclick="groupPay()" >支付<span id="moeny">0</span>元，立即参加</button>
        </div>
    </c:when>
    <c:otherwise>
        <div class="tcbox" id="tcbox" style="height: 15rem;">
            <div class="tctit">我要参与</div>
            <div class="close" id="close" onclick="closeTcbox()">关闭</div>
            <p>请留下联系方式以便我们及时联系您！</p>
            <input type="text" id="name" placeholder="请输入姓名">
            <input type="text" id="tel" placeholder="请输入电话号码">
            <input type="hidden" id="address" value="">
            <button style="margin-left: 16%";type="button" id="payId" onclick="groupPay() " >支付<span id="moeny">0</span>元，立即参加</button>
        </div>
    </c:otherwise>
</c:choose>




</body>
</html>
